<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <!-- <input type="text" name="" id=""> -->


  <div>
    <input type="text">
    <ul>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
    </ul>
  </div>


  <script>

    const inp = document.querySelector('input')
    inp.addEventListener('focus', function () {
      console.log('获得焦点')
    })
    inp.addEventListener('blur', function () {
      console.log('失去焦点')
    })

  </script>

</body>

</html>